import java.sql.*;

//Reading data from array type stud table:
public class JdbcDemo29 {

	public static void main(String[] args) throws Exception{
		Class.forName("oracle.jdbc.driver.OracleDriver");
		Connection cn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","kushwaha","oracle");
		PreparedStatement ps = cn.prepareStatement("select * from stud");
		ResultSet rs = ps.executeQuery();
		while(rs.next())
		{
			String name = rs.getString(1);
			Array a = rs.getArray(2);
			ResultSet r = a.getResultSet();
			System.out.println(name);
			while(r.next())
			{
				System.out.println(r.getString(2));
			}
		}
		// TODO Auto-generated method stub

	}

}
